<#include "/templates/common/jdiy_macros.ftl"/>
<@body local=true>
<form class="layui-form" id="form${_}" lay-filter="form${_}" action="${ctx}/mgmt/${modelName}/save" method="post" method="post" style="padding: 20px 30px 0 0;">
    <@formRow>
        <@formItem label='字典名' col=2>
            <@input name='name' verify="required"/>
        </@formItem>
        <@formItem label='字典KEY' col=2>
            <#if vo.id=='0'><@input name='id' value='' verify="required" placeholder="添加后不可修改"/>
            <#else>
                <input type="text" name="id" style="background-color: #f6f6f6;color:#666;"
                       value="${vo.id}" autocomplete="off" class="layui-input" readonly>
            </#if>
        </@formItem>
    </@formRow>
    <@formRow>
        <@formItem label='字典类型' col=2>
            <select name="type">
                <option value="1">单一值</option>
                <option value="2"<#if vo.type=2> selected</#if>>键值对</option>
                <option value="3"<#if vo.type=3> selected</#if>>键值对 + 颜色</option>
            </select>
        </@formItem>
        <@formItem label='排序索引' col=2>
            <@input name='sortIndex' verify="required|number"/>
        </@formItem>
    </@formRow>
    <@formRow>
        <@formItem label='键名' col=2>
            <@input name='keyName' placeholder="名称" verify="required"/>
        </@formItem>
        <@formItem label='值名' col=2>
            <@input name='valName' placeholder="值" verify="required"/>
        </@formItem>
    </@formRow>
    <@formRow>
        <@formItem label='配置提示' col=1>
            <@textarea name="remark" placeholder="给管理员用户提示配置提示信息．"/>
        </@formItem>
    </@formRow>
    <@formRow>
        <@formItem label="配置选项" col=1>
            <input type="checkbox" name="hidden" title="隐藏字典" value="true" <#if vo.hidden>checked</#if> lay-skin="primary">
            <input type="checkbox" name="editable" title="允许修改" value="true" <#if vo.editable>checked</#if> lay-skin="primary">
            <input type="checkbox" name="addable" title="允许添加" value="true" <#if vo.addable>checked</#if> lay-skin="primary">
            <input type="checkbox" name="removable" title="允许删除" value="true" <#if vo.removable>checked</#if> lay-skin="primary">
        </@formItem>
    </@formRow>

    <div style="display: none;"><@submit/></div>
</form>
</@body>
<@footer>
    <script>

        layui.use([], function () {
            var form = layui.form;
            form.on('submit(submit${_})', function (data) {
                return jdiyAdmin.ajaxSubmit(data.form);
            });
        })
    </script>
</@footer>
